package top.hzy520.message.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.support.MessageBuilder;


/**
 * @Author: HouZeYu
 * @Description:
 * @Date: Created in 21:24 2018/7/19
 */
@EnableBinding(Source.class)
public class MessagePostService {

    @Autowired
    private Source source;
   /**
   *@Author: HouZeYu
   *@Description:  发送消息
   *@Date: 13:02 2018/7/21
   */
    public void postMessage(String message){
       source.output().send(MessageBuilder.withPayload(message).build());
    }
}
